Counterintuitive behaviour with chuffed

20 views
Skip to first unread message

Aura Sofia

unread,
May 15, 2025, 4:27:56 PMMay 15
to MiniZinc
Hello,

I have this following constraint in my Minizinc model:

constraint forall(s in index_set(shiftVars) where  shiftVars[s].numD > 0) (
    forall(d in 0..shiftVars[s].numD-1)(
    if ( d<shiftVars[s].numD /\ d>=0 /\ occurs(shiftVars[s].walk[d].start) ) then (
    shiftVars[s].walk[d].duration == shiftVars[s].drive[d].start - shiftVars[s].walk[d].start) endif
    ));


As you can see, there are some unnecessary parts in it. Now, I wanted to remove for example d<shiftVars[s].numD, as it has no practical use. (d is looped until shiftVars[s].numD-1, so it will never be bigger than shiftVars[s].numD and the result is always true.) 

However, as soon as I remove it, the runtime for the chuffed solver rises a lot (14 seconds vs. 1 min 24 seconds),  and the number of nodes rises from 31607 to 39015. I always used the same seed.

This seems really counterintuitive to me. Why does this happen?

Mikael Zayenz Lagerkvist

unread,
May 15, 2025, 4:46:36 PMMay 15
to mini...@googlegroups.com
Since Chuffed uses LCG and automatic search, small changes in models may lead to surprising changes in behavior. 

That said, you change looks quite harmless. Have you looked at the resulting flatzinc (the compile option in the ide) to see the difference before and after the change? It might be instructive. 

Cheers
Mikael

--
Mikael Zayenz Lagerkvist

On 15 May 2025, at 12:57, Aura Sofia <sofia....@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "MiniZinc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minizinc+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/minizinc/60d563fc-5250-4016-9d99-991004b5b8f1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages